# !/usr/bin/env python
# -*- coding: utf-8 -*-

from django.shortcuts import render, redirect, HttpResponse
from django.views.decorators.csrf import csrf_exempt

from mytest.utils.common_crud import ComCrud
from mytest.utils.forms import *


def user_list(request):

    user_form = UserModelForm()

    queryst = models.User.objects.all()
    print(queryst)

    response = {
        "status": True,
        "data": {
            "form": user_form,
            "rows": queryst
        }
    }

    return render(request, "mytest/user_page.html", response)


@csrf_exempt
def user_add(request):
    """ 添加用户 """

    return ComCrud().get_add(request, "User")
